package com.mc.test.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.mc.test.domain.User;
import com.mc.test.service.UserService;

@Controller
public class UserController {

	@Autowired
	private UserService userService;

	@RequestMapping(value = "/error", method = RequestMethod.GET)
	public String listAllUser(Model model) {

		List<User> userList = null;// getAllUser();
		model.addAttribute("user", userList);
		return "/error/404";
	}

	@RequestMapping(value = "/test", method = RequestMethod.GET)
	public String home(Model model) {
		System.out.println("In Controller's Home");
		String users = userService.testDummy();
		model.addAttribute("users", users);

		return "user";
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

}